package com.example.system.controller.user;

import com.example.common.core.controller.BaseController;
import com.example.common.core.model.R;
import com.example.common.core.model.TableDataInfo;
import com.example.system.model.user.dto.UserDTO;
import com.example.system.model.user.dto.UserQueryDTO;
import com.example.system.model.user.vo.UserVO;
import com.example.system.service.IUserService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 功能描述:
 *
 * @author Lenovo
 * @date 2025/3/26
 */
@RestController
@RequestMapping("/user")
public class UserController extends BaseController {

    @Resource
    private IUserService userService;

    @GetMapping("/list")
    public TableDataInfo list(UserQueryDTO userQueryDTO){
        List<UserVO> list = userService.list(userQueryDTO);
        return getTableDataInfo(list);
    }

    @PutMapping("/updateStatus")
    public R<Void> updateStatus(@RequestBody UserDTO userDTO){
        int row = userService.updateStatus(userDTO);
        return toResult(row);
    }
}
